from fastapi import APIRouter, FastAPI

router = APIRouter()

def register_middleware(app: FastAPI, middlewares: list[dict]):
    for middleware in middlewares:
        for k,v in middleware.items():
            app.add_middleware(k, **v)


@router.get("/")
async def read_root():
    return {"message": "Hello World"}